<?php

use IDock\IDock\IDock;
use IDock\Insurance\QHIC\QHICConstruct;
use IDock\Printer\EPolicyDownloadPrinter;
use IDock\Printer\PolicyPaymentPrinter;
use IDock\Printer\Premium\PremiumInquiryPrinter;
use IDock\Printer\PremiumUnderwritingPrinter;
use IDock\Printer\ProposalRecallPrinter;
use IDock\Printer\ProposalStatusPrinter;
use IDock\Printer\RenewalInquiryPrinter;
use IDock\Printer\UnderwritingRecallPrinter;
use IDock\Printer\UploadFilePrinter;
use IDock\Printer\VehicleActualValuePrinter;
use IDock\Printer\VehicleModelPrinter;
use IDock\Visitor\EPolicyDownloadVisitor;
use IDock\Visitor\NonCar\NonCarInquiryVisitor;
use IDock\Visitor\NonCar\NonCarProductListVisitor;
use IDock\Visitor\NonCar\NonCarProductVisitor;
use IDock\Visitor\PolicyInfoVisitor;
use IDock\Visitor\PolicyPaymentVisitor;
use IDock\Visitor\Premium\PremiumCarTaxVisitor;
use IDock\Visitor\Premium\PremiumChargingPileVisitor;
use IDock\Visitor\Premium\PremiumCoverageVisitor;
use IDock\Visitor\Premium\PremiumExtInfoVisitor;
use IDock\Visitor\Premium\PremiumInquiryVisitor;
use IDock\Visitor\Premium\PremiumNoCarVisitor;
use IDock\Visitor\Premium\PremiumPolicyVisitor;
use IDock\Visitor\Premium\PremiumRelationVisitor;
use IDock\Visitor\Premium\PremiumUnderwritingVisitor;
use IDock\Visitor\Premium\PremiumVehicleVisitor;
use IDock\Visitor\ProposalRecallVisitor;
use IDock\Visitor\ProposalStatusVisitor;
use IDock\Visitor\RenewalInquiryVisitor;
use IDock\Visitor\UnderwritingRecallVisitor;
use IDock\Visitor\UploadFileVisitor;
use IDock\Visitor\VehicleActualValueVisitor;
use IDock\Visitor\VehicleModelVisitor;

require_once('./vendor/autoload.php');

$IDock = new IDock();

$QHICConfig = [
    'gateway' => '*************',
    'logsDir' => '*************',
    'timeout' => '*************',
    'chalCode' => '*************',
    'userCode' => '*************',
    'productCode' => '*************',
    'planCode' => '*************',//燃油车
//    'planCode' => 'PLAN003',//新能源

    'proxy' => '118.123.247.195:45131',
];

require_once('config.php');

$IDock->setBean('QHIC', $QHICConfig);


global $testResponse;

$shortName = 'QHIC';

$vin = 'LZWADAGA8HF791218';
$engineNo = '8H73121140';
$licenseNo = '川A9K7R5';
$firstRegisterDate = '2018-05-04';
$vehicleModel = '东南DN7151M5T轿车';

$orderNo = 'D20230807070000002041570f983d914';//

$biStartData = '2023-08-10 00:00:00';
$ciStartData = '2023-09-24 00:00:00';
$biEndData = '2024-08-10 00:00:00';
$ciEndData = '2024-09-23 23:58:59';

/*** @var $demo QHICConstruct */
global $testResponse;
$GLOBALS['testResponse'] = '{"Body":"Qm471/zlph9LkkYQ9cqlr+FShSwrsVC6qU7ZfNXZbIZH5cZb1hUOOapK0ZQAkw2admeWjPsS9QD23WoNtIcGyXpZnjEUcQrKVPQo3H6/lr7q33du+qprUnOc8q83DdwrlI1p/6sufw8IRgwz3eyEFCnLnD4FaE99FKKbyjZgxgy1ScTpld2y06HgMv7b4RzlRVAmh5QT80PJVXMaFyx2I/kW9xRalHk5vX5iqrBJmbbhIFF8DmWgjSXhtCK6IoFLJbiafrF+SHRBTibYxsSOJK5dV9MZe+7fYJrli2sLMXwF3phgvVnO17GR5zUA7fOpUNt4BhHFDlj79b8aDvbsNam+ZgEe0GF2KfLna5clXPgkYO84sLJ/84k3bm37ihNcejSNC0eat+x27Gpa+gxK1uZad2hSvSoWZfeuPFZDrhmiEngUyl5vUKhdCLiwER3NXcl5DV6sffKlZgMYkw2mKdjXqzmzHXc1Bvenkc7kpVDKkVxldITuAMjETecF7Fkp1SuX3GOmGJNInsuGKIVTtY3jw4ilwCrW0qdRCwBs/C3j5GxElAB2an7FpMwsz4Tj0jaTO2Qt5/Qh6KttK4uCJ8p8oVlgCuf9Px/jbebWi3etbLFxtflS2j5jeTwa6k/NqV6Xbvs2dcCG9oqs4UPhely/6BndB3wSzI8hT5Z05MXheIFBSn2rU9CC7kN8En4hvDU+5UfhoBF28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3/WO9pihTNDAUAVkiIuw26qLUbGTq9EZ7VOHfUH8VImRmvvkodWGXuX4/2GbA1eGiTUzDqS4zDsfOmHkcnB3Tva51+vGM+9+a0AsYEXd2xpemCe8wIHU0RV+7sm1kNF8C0qDBPNPO3O6STwOuGt8J3fQuP4710T6bZh5+DKLdHL8Byd/Qel+Gew4RQlstaSsDxYNKqgLI4eSZeKnyg0JE1qIgWV6HNVFf7m9ey0d9hEKxWtYD1h6jKSGBrv92CFlyXBG7DQiiiglU1W65wRw671OL7mkNYt+4xM6UG/6Ypz0iN2iUpkuPiqXHapYNU7VPF7StcPUWmIIE0cXN370Pa8OqwQURqWGvxMzEXI3491EOISNJU2U3FyxWmJujsDRVSJG6kaIAqKJK9LKg0igpLdTIE4pir1Q1+aX1IG+/RceQxwyAxni2+1bUNGjXVQtYb2piUApqrDY2kiKiiktKyMyIsIbUJ58fnABcyTuC0G/kJqwdkAGbgshEhFq/3esSCXo804gBTq1J5ffMztyBq0VGHUsXK+s=","Head":{"TransId":"e759edb2f80ac38f16c7bdbb8b8e0836","ErrorCode":"0000","RequestType":"VHL0005","TransDate":"20240813142226"}}';


try {


//续保查询接口
    if (0) {
        //续保查询接口
        $renewalInquiryVisitor = new RenewalInquiryVisitor();
        //车架号
        $renewalInquiryVisitor->vin = $vin;
        //发动机号
        $renewalInquiryVisitor->engineNo = $engineNo;
        //车牌号
        $renewalInquiryVisitor->licenseNo = $licenseNo;
        $renewalInquiryVisitor->argc['type'] = 1;

        $response = $IDock->renewalInquiry($shortName, $renewalInquiryVisitor);

        var_dump($response->isSuccess());
        var_dump($response->getError());

        /**
         * @var $printer RenewalInquiryPrinter
         */
        $printer = $response->getPrinter();
//        var_dump($printer->toArray());
        exit;
    }

//车辆车型查询接口
    if (0) {
        //车辆车型查询接口
        $vehicleModelVisitor = new VehicleModelVisitor();
        //车架号
        $vehicleModelVisitor->vin = $vin;
        //$vehicleModelVisitor->vin = '';
        //发动机号
        $vehicleModelVisitor->engineNo = $engineNo;
        //车牌号
        $vehicleModelVisitor->licenseNo = $licenseNo;
        //初登时间
//        $vehicleModelVisitor->firstRegisterDate = $firstRegisterDate;
        //车型编码
        $vehicleModelVisitor->vehicleModel = $vehicleModel;

        $response = $IDock->vehicleModel($shortName, $vehicleModelVisitor);
        var_dump($response->isSuccess());
        var_dump($response->getError());

        /**
         * @var $printer VehicleModelPrinter
         */
        $printer = $response->getPrinter();
        if ($printer) var_dump($printer->toArray());
        exit;
    }

//车辆实际价格
    if (0) {
        //车辆实际价格
        $vehicleActualValueVisitor = new VehicleActualValueVisitor();
        $vehicleActualValueVisitor->startDate = $biStartData;
        $vehicleActualValueVisitor->firstRegisterDate = $firstRegisterDate;
        //车辆价格
        $vehicleActualValueVisitor->vehiclePrice = '54800';
        //能源类型
        $vehicleActualValueVisitor->energyType = 'E01';
        //是否新能源
        $vehicleActualValueVisitor->isNewEnergy = false;
        //使用性质
        $vehicleActualValueVisitor->useNatureCode = '01';
        //车辆用途
        $vehicleActualValueVisitor->causeType = '001';
        //车辆种类
        $vehicleActualValueVisitor->carKindCode = '100';
        //座位数
        $vehicleActualValueVisitor->vehicleSeat = '5';
        //荷载质量
        $vehicleActualValueVisitor->vehicleTonnage = '0';

        $response = $IDock->vehicleActualValue($shortName, $vehicleActualValueVisitor);
        var_dump($response->isSuccess());
        var_dump($response->getError());

        /**
         * @var $printer VehicleActualValuePrinter
         */
        $printer = $response->getPrinter();
        var_dump($printer->toArray());
        exit;
    }

//询价前置
//保费计算
//核保
    if (1) {

        /**
         * 询价主信息
         */
        $premiumInquiryVisitor = new PremiumInquiryVisitor();
        //商业险起保日期
        $premiumInquiryVisitor->biStartData = $biStartData;
        //商业险终保日期
        $premiumInquiryVisitor->biEndData = $biEndData;
        //交强险起保日期
        $premiumInquiryVisitor->ciStartData = $ciStartData;
        //交强险终保日期
        $premiumInquiryVisitor->ciEndData = $ciEndData;
        //商业险即时生效
        $premiumInquiryVisitor->biEffectFlag = false;
        //交强险即时生效
        $premiumInquiryVisitor->ciEffectFlag = false;

        $premiumInquiryVisitor->isNewEnergy = true;

        /**
         * 车辆信息
         */
        $premiumVehicleVisitor = new PremiumVehicleVisitor();
        //是否新车
        $premiumVehicleVisitor->isNewVehicle = '1';
        //车架号
        $premiumVehicleVisitor->vin = $vin;
        //发动机号
        $premiumVehicleVisitor->engineNo = $engineNo;
        //车牌号
        $premiumVehicleVisitor->licenseNo = $licenseNo;
        //初登时间
        $premiumVehicleVisitor->firstRegisterDate = $firstRegisterDate;
        //过户时间
        $premiumVehicleVisitor->transferDate = '';
        //是否过户车
        $premiumVehicleVisitor->isTransfer = '0';
        //发证时间
        $premiumVehicleVisitor->issueDate = '';
        //车型编码
        $premiumVehicleVisitor->vehicleModel = $vehicleModel;
        //车型编码代码
        $premiumVehicleVisitor->vehicleModelCode = 'DZABJD0007';
        //$premiumVehicleVisitor->vehicleModelCode = 'BTYOSPUB0014';
        //车型名称
        $premiumVehicleVisitor->vehicleName = '丰田TV7152X轿车';
        //车价
        $premiumVehicleVisitor->vehiclePrice = '85535';
        //车价含税
        $premiumVehicleVisitor->vehiclePriceTax = '85535';
        //协商价格
        $premiumVehicleVisitor->actualValue = '82968.95';
        //座位数
        $premiumVehicleVisitor->vehicleSeat = '5';
        //使用性质
        $premiumVehicleVisitor->useNatureCode = '01';
        //所属性质
        $premiumVehicleVisitor->attachNature = '01';
        //车辆用途
        $premiumVehicleVisitor->causeType = '001';
        //车辆种类
        $premiumVehicleVisitor->carKindCode = '100';
        //能源类型代码
        $premiumVehicleVisitor->energyTypeCode = 'E01';
        //号牌颜色代码
        $premiumVehicleVisitor->licenseColorCode = '01';
        //号牌种类代码
        $premiumVehicleVisitor->licenseTypeCode = '02';
        //交管车辆类型代码
        $premiumVehicleVisitor->vehicleStyleCode = 'K33';
        //功率
        $premiumVehicleVisitor->power = '79.0';
        //排量
        $premiumVehicleVisitor->vehicleExhaust = '1.496';
        //整备质量
        $premiumVehicleVisitor->wholeWeight = '10.2';
        //荷载质量
        $premiumVehicleVisitor->vehicleTonnage = '0.0';
        //进口标识
        $premiumVehicleVisitor->vehicleImport = 'I2';
        //是否能源车
        $premiumVehicleVisitor->isNewEnergy = true;
        //纯电续航里程(公里)
        $premiumVehicleVisitor->pureRange = '';
        //车辆来历凭证编号
        $premiumVehicleVisitor->carCertificateNo = '';
        //开具车辆来历凭证所载日期
        $premiumVehicleVisitor->carCertificateDate = '';
        //车辆来历凭证种类代码
        $premiumVehicleVisitor->carCertificateType = '';

        /**
         * 关系人
         */
        $premiumRelationVisitor = new PremiumRelationVisitor();
        //姓名
        $premiumRelationVisitor->name = '廖皓';
        //联系方式
        $premiumRelationVisitor->mobile = '13550217453';
        //类型
        $premiumRelationVisitor->typeCode = 'R1';
        //证件类型
        $premiumRelationVisitor->certificateTypeCode = '01';
        //证件号码
        $premiumRelationVisitor->certificateNo = '51390219960714105X';
        //地址
        $premiumRelationVisitor->address = '四川省成都市龙泉驿区龙泉车城西一路185号1栋1单元20楼2001号';
        //邮箱
        $premiumRelationVisitor->email = '18982272991@qq.com';
        //证件有效期
        $premiumRelationVisitor->certificateStartDate = '2000-01-01';
        //证件失效期
        $premiumRelationVisitor->certificateEndDate = '2050-01-01';

        /**
         * 缴税信息
         */
        $premiumCarTaxVisitor = new PremiumCarTaxVisitor();
        //缴税内心
        $premiumCarTaxVisitor->taxTypeCode = 'T01';
        //纳税人姓名
        $premiumCarTaxVisitor->taxpayerName = '樊鑫';
        //纳税人证件类型
        $premiumCarTaxVisitor->taxpayerCertificateTypeCode = '01';
        //纳税人证件号码
        $premiumCarTaxVisitor->taxpayerCertificateNo = '51390219960714105X';
        //纳税人电话
        $premiumCarTaxVisitor->taxpayerPhone = '13550217453';
        //纳税起期
        $premiumCarTaxVisitor->taxStartDate = '2023-08-10 00:00:00';
        //纳税止期
        $premiumCarTaxVisitor->taxEndDate = '2024-08-09 23:59:59';
        //减免税方案代码
        $premiumCarTaxVisitor->taxReductionCode = '';
        //减免税原因代码
        $premiumCarTaxVisitor->taxReductionReasonCode = '';
        //税务机关名称
        $premiumCarTaxVisitor->taxDepartment = '';
        //税务机关代码
        $premiumCarTaxVisitor->taxDepartmentCode = '';
        //开具完税凭证地区代码
        $premiumCarTaxVisitor->taxPaidAreaCode = '';
        //完税凭证填发日期
        $premiumCarTaxVisitor->taxDocumentDate = '';
        //减免比例 百分比
        $premiumCarTaxVisitor->taxFreeRate = '';
        //减税金额 元
        $premiumCarTaxVisitor->taxExemption = '';
        //减免完税凭证号
        $premiumCarTaxVisitor->taxDocumentNumber = '';

        //险种

        //
        $premiumCoverageVisitor = new PremiumCoverageVisitor();
        $premiumCoverageVisitor->coverageCode = 'C01001';
        $premiumCoverageVisitor->amount = '200000';

//        $premiumCoverageVisitor1 = new PremiumCoverageVisitor();
//        $premiumCoverageVisitor1->coverageCode = 'C05001';
//        $premiumCoverageVisitor1->amount = '40000';
//        $premiumCoverageVisitor1->unitAmount = '10000';
////        $premiumCoverageVisitor1->deductionRate = '5';
////
//        $premiumCoverageVisitor2 = new PremiumCoverageVisitor();
//        $premiumCoverageVisitor2->coverageCode = 'C03001';
//        $premiumCoverageVisitor2->amount = '1000000';
////        $premiumCoverageVisitor2->deductionRate = '5';
//
//        $premiumCoverageVisitor3 = new PremiumCoverageVisitor();
//        $premiumCoverageVisitor3->coverageCode = 'C02001';
//        $premiumCoverageVisitor3->amount = '109409.8';


        //新能源充电桩信息
        $premiumChargingPileVisitor = new PremiumChargingPileVisitor();

        $premiumChargingPileVisitor->seqNo = '1';
        //充电桩类型
        $premiumChargingPileVisitor->chargingPileKind = 'PK1';
        //充电桩安装地点类型
        $premiumChargingPileVisitor->chargingPileAddressType = 'PA1';
        //充电桩使用年限
        $premiumChargingPileVisitor->chargingPileYearLimit = 'PY1';
        //充电桩编码
        $premiumChargingPileVisitor->chargingPileCode = '123456';
        //充电桩型号
        $premiumChargingPileVisitor->chargingPileType = 'BCS100500';
        //充电桩地址
        $premiumChargingPileVisitor->chargingPileAddress = '地面充电桩';
        //损失保险保额
        $premiumChargingPileVisitor->lossAmount = '';
        //责任保险保额
        $premiumChargingPileVisitor->liabilityAmount = '10000';

        /**
         * 拓展信息
         */
        $premiumExtInfoVisitor = new PremiumExtInfoVisitor();
        //验车情况
        $premiumExtInfoVisitor->carCheckCode = 'CS3';//已验
        //免验原因
        $premiumExtInfoVisitor->carCheckReasonKind = '';
        //验车人
        $premiumExtInfoVisitor->carChecker = '张三';
        //验车日期
        $premiumExtInfoVisitor->carCheckDate = '2023-08-02';
        //验车地点
        $premiumExtInfoVisitor->carAddress = '';
        //是否送修
        $premiumExtInfoVisitor->isMonopoly = '0';
        //送修代码
        $premiumExtInfoVisitor->repairCode = '';
        //送修名称
        $premiumExtInfoVisitor->repairName = '';
        //自主定价系数
        $premiumExtInfoVisitor->selfPricingFactor = '';
        //自主核保系数
        $premiumExtInfoVisitor->underwritingFactor = '';
        //期望折扣
        $premiumExtInfoVisitor->expectedDiscount = '';
        //是否贷款车
        $premiumExtInfoVisitor->isLoanCar = '';
        //贷款机构名称
        $premiumExtInfoVisitor->loanOrg = '';

        //珠峰拓展

        //$premiumExtInfoVisitor->argc['orderNo'] = 'C20231201110525912000207270';
        //$premiumExtInfoVisitor->argc['businessNo'] = 'HX202312011105255951';


        //添加车辆信息
        $premiumInquiryVisitor->setVehicleVisitor($premiumVehicleVisitor);
        //添加投保人
        $premiumInquiryVisitor->setApplicantVisitor($premiumRelationVisitor);
        //添加被保人
        $premiumInquiryVisitor->setInsuredVisitor($premiumRelationVisitor);
        //添加车主
        $premiumInquiryVisitor->setOwnerVisitor($premiumRelationVisitor);
        //车船税
        $premiumInquiryVisitor->setCarTaxVisitor($premiumCarTaxVisitor);

        /**
         * 非车列表
         */
        $nonCarInquiryVisitor = new NonCarInquiryVisitor();
        ////投保份数
        //$nonCarInquiryVisitor->setApplicantVisitor($premiumInquiryVisitor->getApplicantVisitor());
        ////产品代码
        //$nonCarInquiryVisitor->prodCode = '';
        ////方案代码
        //$nonCarInquiryVisitor->schemeCode = '';
        ////每份保额
        //$nonCarInquiryVisitor->prePremium = '';
        ////总保费
        //$nonCarInquiryVisitor->sumPremium = '';

        //险种添加
//        $premiumInquiryVisitor->coverageVisitorAppend($premiumCoverageVisitor1);
//        $premiumInquiryVisitor->coverageVisitorAppend($premiumCoverageVisitor2);
//        $premiumInquiryVisitor->coverageVisitorAppend($premiumCoverageVisitor3);
        $premiumInquiryVisitor->coverageVisitorAppend($premiumCoverageVisitor);
        //新能源充电桩
//        $premiumInquiryVisitor->chargingPileVisitorAppend($premiumChargingPileVisitor);
        //拓展信息
        $premiumInquiryVisitor->setExtInfoVisitor($premiumExtInfoVisitor);
        //非车信息
        $premiumInquiryVisitor->setNonCarInquiryVisitor($nonCarInquiryVisitor);
        $premiumInquiryVisitor->setNonCarUnderwritingVisitor($nonCarInquiryVisitor);

        //询价前置
//        $response = $IDock->preInquiry($shortName, $premiumInquiryVisitor);
//        var_dump($response->isSuccess());
//        var_dump($response->getError());
//        /**
//         * @var $printer \IDock\Printer\preInquiryPrinter;
//         */
//        $printer = $response->getPrinter();
//        var_dump($printer->toArray());
//        exit;

        //询价
        $response = $IDock->premiumInquiry($shortName, $premiumInquiryVisitor);
        var_dump($response->isSuccess());
        var_dump($response->getError());

        /**
         * @var $printer PremiumInquiryPrinter;
         */
        $printer = $response->getPrinter();
        if ($printer) {
            var_dump($printer->toArray());
        }

        exit;

        /**
         * 核保信息
         */
        $premiumUnderwritingVisitor = new PremiumUnderwritingVisitor();
        $premiumUnderwritingVisitor->biInquiryNo = '';
        $premiumUnderwritingVisitor->ciInquiryNo = '';

        $premiumUnderwritingVisitor->agreement = [];

        $premiumInquiryVisitor->setUnderwritingVisitor($premiumUnderwritingVisitor);
        //核保
        $response = $IDock->underwriting($shortName, $premiumInquiryVisitor);

        var_dump($response->isSuccess());
        var_dump($response->getError());

        /**
         * @var $printer PremiumUnderwritingPrinter;
         */
        $printer = $response->getPrinter();

        if ($printer) var_dump($printer->toArray());
        exit;
    }

//支付
    if (0) {
        $policyPaymentVisitor = new PolicyPaymentVisitor();
        $policyPaymentVisitor->inquiryNo = '599510803602023000184';
        $policyPaymentVisitor->biInquiryNo = '';
        $policyPaymentVisitor->ciInquiryNo = '599510803602023000184';
        $response = $IDock->policyPayment($shortName, $policyPaymentVisitor);

        var_dump($response->isSuccess());
        var_dump($response->getError());
        /**
         * @var $printer PolicyPaymentPrinter
         */
        $printer = $response->getPrinter();

        var_dump($printer->toArray());
        exit;
    }

//影像资料上传
    if (0) {
        $uploadFileVisitor = new UploadFileVisitor();
        $uploadFileVisitor->inquiryNo = 'M232010136320230000010';
        $uploadFileVisitor->biInquiryNo = 'T232010080820230000014';
        $uploadFileVisitor->ciInquiryNo = 'T232010080120230000010';

        $appType = 'G_HX';//一级代理和二级代理
        $orgNum = '07000002';//出单机构
        $oprId = '00000020';//操作员编码
        $upType = '2';//上传方式 1（文件流），2（ftp）
        $imageList = [
            [
                'imgName' => 'test111.jpg',//要求英文
//                'base64Img' => base64_encode(file_get_contents(__DIR__ . '/test.jpg')),//图片base64编码
                'filedSuffix' => 'jpg',//文件后缀
                'filedPath' => 'https://p0.itc.cn/q_70/images03/20220512/77ed76720a1f40ef94948761dda05655.jpeg',//图片地址 ftp模式必传
            ],
        ];
        foreach ($imageList as $val) {
            $uploadFileVisitor->fileAppend('10017', $val['filedPath'], '');
        }
        $uploadFileVisitor->argc['isNewCar'] = 1;
        $uploadFileVisitor->argc['platOrderNo'] = 'C20230816095559578000106043';

        $response = $IDock->UploadFile($shortName, $uploadFileVisitor);

        var_dump($response->isSuccess());
        var_dump($response->getError());

        /**
         * @var  $printer UploadFilePrinter
         */
        $printer = $response->getPrinter();

        if (!empty($printer)) var_dump($printer->toArray());
        exit;
    }

//投保单查询
    if (0) {
        $proposalStatusVisitor = new ProposalStatusVisitor();

        $proposalStatusVisitor->inquiryNo = '599510803602023000279';
        $proposalStatusVisitor->biInquiryNo = '';
        $proposalStatusVisitor->ciInquiryNo = '599510803602023000279';
        $proposalStatusVisitor->argc['orderNo'] = 'NSNL202403081715380484';
        $response = $IDock->proposalStatus($shortName, $proposalStatusVisitor);

        var_dump($response->isSuccess());
        var_dump($response->getError());

        /*** @var $printer ProposalStatusPrinter; */
        $printer = $response->getPrinter();

        var_dump($printer);
        exit;
    }

//撤单
    if (0) {
        $proposalRecallVisitor = new ProposalRecallVisitor();

        $proposalRecallVisitor->inquiryNo = '599510803682023000036';
        $proposalRecallVisitor->biInquiryNo = '';
        $proposalRecallVisitor->ciInquiryNo = '599510803682023000036';
        $proposalRecallVisitor->reason = '客户注销';
        $proposalRecallVisitor->argc['orderNo'] = 'NSYZ202402211109289919';

        $response = $IDock->proposalRecall($shortName, $proposalRecallVisitor);

        var_dump($response->isSuccess());
        var_dump($response->getError());

        /**
         * @var $printer ProposalRecallPrinter
         */
        $printer = $response->getPrinter();
        var_dump($printer);
        exit;
    }

//核保撤单
    if (0) {
        $underwritingRecallVisitor = new UnderwritingRecallVisitor();

        $underwritingRecallVisitor->inquiryNo = 'M232010136320230000010';
        $underwritingRecallVisitor->biInquiryNo = 'T232010080820230000014';
        $underwritingRecallVisitor->ciInquiryNo = 'T232010080120230000010';
        $underwritingRecallVisitor->reason = '投保注销';
        $underwritingRecallVisitor->argc['OrgCode'] = '51080503';


        $underwritingRecallVisitor->argc['platOrderNo'] = 'C20230816095559578000106043';

        $response = $IDock->underwritingRecall($shortName, $underwritingRecallVisitor);

        var_dump($response->isSuccess());
        var_dump($response->getError());

        /**
         * @var $printer UnderwritingRecallPrinter
         */
        $printer = $response->getPrinter();
        if (!empty($printer)) var_dump($printer->toArray());
        exit;

    }

//电子保单下载
    if (0) {
        $EPolicyDownloadVisitor = new EPolicyDownloadVisitor();

        $EPolicyDownloadVisitor->policyNo = '2070003562023000259';
        $EPolicyDownloadVisitor->argc['orderNo'] = 'P435019C052400000014140';

        $response = $IDock->EPolicyDownload($shortName, $EPolicyDownloadVisitor);

        var_dump($response->isSuccess());
        var_dump($response->getError());
        var_dump($response->getPrinter()->data);


        /**
         * @var $printer EPolicyDownloadPrinter
         */
        $printer = $response->getPrinter();
        var_dump($printer->finish);
        exit;
    }

//获取非车产品列表
    if (0) {
        $visitor = new NonCarProductListVisitor();
        $visitor->argc['CAgentNo'] = 'J00005710';
        $visitor->argc['CBrkrCde'] = '10000002256';

        $demo = $IDock->getBean($shortName);
        $response = $demo->nonCarProductList($visitor);

        var_dump($response->isSuccess());
        var_dump($response->getError());
        var_dump($response->getPrinter()->toArray());
        exit;
    }

//保单详情
    if (0) {
        $policyInfoVisitor = new PolicyInfoVisitor();

        $policyInfoVisitor->policyNo = 'C20230816095559578000106043';
        $policyInfoVisitor->argc['platOrderNo'] = 'C20230816095559578000106043';
        $response = $IDock->policyInfo($shortName, $policyInfoVisitor);
        var_dump($response->isSuccess());
        var_dump($response->getError());
        var_dump($response->getPrinter()->toArray());
        exit;
    }

    //添加非车产品
    if (0) {
        $visitor = new NonCarInquiryVisitor();
        $single = new NonCarProductVisitor();
        $visitor->argc['orderNo'] = 'NSQQ202403051447461096';
        $single->productCode = '0201741';
        $single->planCode = '0003';
        $single->insuredNum = '1';
        $single->premium = '388';
        $visitor->nonCarListAppend($single);
        $demo = $IDock->getBean($shortName);
        $response = $demo->addNonCarOrder($visitor);
        var_dump($response->isSuccess());
        var_dump($response->getError());
        var_dump($response->getPrinter()->toArray());
        exit;
    }
    //
} catch (Exception $e) {
    var_dump("异常抛出：" . $e->getFile() . " " . $e->getLine() . $e->getMessage());
}
